﻿<%--
 *  File:    VisitPlanEditDetail.jsp
 *  @Author: KentZhong 
 *  Date:    2009-10-9 10:02:44
 *
 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>


<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
    String strModuleName = "SFE";
    String privilegeCode = "H0255,H0256";
  	String contextPath = request.getContextPath();
%>



<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<iframe name="reloadHandler" style="display:none"></iframe>
<title><%=label.getLabelName("L_EditWeekVisitPlan")%></title>
<%
if("Y".equals(request.getParameter("isconfirm"))){%>

%>
<script>
	opener.refreshWindow();
</script>
<%return;
}%>	
<%
int nYear=0;
int nMonth=0;
int nWeek=0;
if(request.getParameter("year")!=null)
{
	nYear=Integer.parseInt(request.getParameter("year"));
}
else if(session.getAttribute("year")!=null)
{
	nYear=((Integer)session.getAttribute("year")).intValue();
}
if(request.getParameter("monthofyear")!=null)
{
	nMonth=Integer.parseInt(request.getParameter("monthofyear"));
}
else if(session.getAttribute("monthofyear")!=null)
{
	nMonth=((Integer)session.getAttribute("monthofyear")).intValue();
}
if(request.getParameter("weekofmonth")!=null)
{
	nWeek=Integer.parseInt(request.getParameter("weekofmonth"));
}
else if(session.getAttribute("weekofmonth")!=null)
{
	nWeek=((Integer)session.getAttribute("weekofmonth")).intValue();
}
Date dWeekStart=null;
Date dWeekEnd=null;
String strWeekStart="";
String strWeekEnd="";
String strFullDateFormat=label.getLabelName("L_FullDateFormat");
int nStartDayWeekOfMonth=0;
Calendar cal=null;
if(nYear>0 && nMonth>0 && nWeek>0)
{
	cal=Calendar.getInstance();
	cal.clear();
	cal.set(Calendar.YEAR, nYear);
	cal.set(Calendar.MONTH, nMonth-1);
	cal.set(Calendar.WEEK_OF_MONTH, nWeek);
	cal.setFirstDayOfWeek(Calendar.MONDAY);
	dWeekStart=cal.getTime();
	cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
	dWeekEnd=cal.getTime();
	//out.print(new java.sql.Date(dWeekStart.getTime()));
	//out.print(new java.sql.Date(dWeekEnd.getTime()));
	nStartDayWeekOfMonth=cal.get(Calendar.WEEK_OF_MONTH);
	session.setAttribute("weekstartdate",new java.sql.Date(dWeekStart.getTime()));
	session.setAttribute("weekenddate",new java.sql.Date(dWeekEnd.getTime()));
	
	java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat(strFullDateFormat);
	Calendar calendar=Calendar.getInstance();
    calendar.setTime(dWeekEnd);
	strWeekEnd=sdf.format(calendar.getTime());
	strWeekStart=sdf.format(dWeekStart);
	cal.clear();
	cal.set(Calendar.YEAR, nYear);
	cal.set(Calendar.MONTH, nMonth-1);
	cal.set(Calendar.WEEK_OF_MONTH, nWeek);
	cal.setFirstDayOfWeek(Calendar.MONDAY);
}
%>
<PageFlow:CheckPageFlow pageName="p_visitplaneditdetail"/>
<%@ include file="/inc/InitEdit.inc" %>
<%
java.util.HashMap userInfo = (java.util.HashMap)session.getAttribute("userinfo"); 
java.util.HashMap contactinfo = (java.util.HashMap)pageContext.getAttribute("contactinfo"); 
if(contactinfo==null) contactinfo=new HashMap();
Integer nCurUserId = (Integer)userInfo.get("userid");
Integer nParentUserId = (Integer)contactinfo.get("parentuserid");
Integer contactid = null;
//System.out.println("contactid1="+session.getAttribute("contactid"));
//System.out.println("contactid2="+Integer.valueOf(request.getParameter("contactid")));
 if (request.getParameter("contactid") == null){
	if(session.getAttribute("contactid")==null){
	 contactid = (Integer)userInfo.get("userid");
	}else{
     contactid = (Integer)session.getAttribute("contactid");
	}
 }else {
	 contactid = Integer.valueOf(request.getParameter("contactid"));
 }
HashMap visitplaninfo=(HashMap)pageContext.getAttribute("visitplaninfo");
		if(visitplaninfo==null)
			visitplaninfo=new HashMap();
int nStatus=-1;
String strStatus="";
if(	visitplaninfo.get("status")!=null)
{
		nStatus=((Integer)	visitplaninfo.get("status")).intValue();
		strStatus=com.oval.util.OvalDictionaryEngine.getDictionaryValueName("Status",strLanguageCode,""+nStatus).getM_strValueName();
}
Vector vDetails=(Vector)pageContext.getAttribute("visitplandetails");	
		if(vDetails==null)
			vDetails=new Vector();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script>
function page_finish()
{
	opener.refreshWindow();
}
function page_needassist(num,seq,id,code,name)
{
	var myform = eval("document.cform"+num);
	var sneedassist=eval("myform.showneedassist"+seq);
	var needassist=eval("myform.needassist"+seq);
	var changedid = eval("myform.changedid"+seq);
	var leaderchange = eval("myform.leaderchange");
	var div = document.getElementById("assistdiv_"+num+"_"+seq); 
	if(sneedassist.checked)
	{
		needassist.value="Y";
		if(leaderchange.value!=null){
		changedid.value="<%=nCurUserId%>";
		}
		div.style.display = 'block';
		 if(isEmpty(eval("document.cform"+num+".assistuserid"+seq).value)){
		  eval("document.cform"+num+".assistuserid"+seq).value=id;
		  eval("document.cform"+num+".assistusername"+seq).value=code;
		  eval("document.cform"+num+".assistemployeename"+seq).value=name;
		 }
	}
	else{
		needassist.value="N";	
		changedid.value=" ";	
		eval("myform.assistuserid"+seq).value=" ";
		div.style.display = 'none';
	}
}
function page_selectUser(num,seq) {
        document.getElementById("selectcrownum").value=num;
        document.getElementById("selectcseq").value=seq;
        //alert(eval("document.cform.assistuserid"+num).value);
		var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%=contextPath%>/sfe/UserSelectPop.jsp?businessareaid="+<%=userInfo.get("businessareaid")%>+"&contactid=<custom:write property="contactid"/>"+"&o_thread=" + Math.random();
			
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow2", status);
}
function page_setUser(id,code,name){
	var crownum= document.getElementById("selectcrownum").value;
	var myform = eval("document.cform"+crownum);
	var cseq= document.getElementById("selectcseq").value;
	eval("myform.assistuserid"+cseq).value=id;
	eval("myform.assistusername"+cseq).value=code;
	eval("myform.assistemployeename"+cseq).value=name;
}
function refreshWindow()
{
	var strUrl="VisitPlanEditDetail.jsp?ishistory=<custom:write property="ishistory"/>&contactid=<custom:write property="contactid"/>&orgid=<custom:write property="orgid"/>";
		strUrl=strUrl+"&year=<custom:write property="year"/>&monthofyear=<custom:write property="monthofyear"/>&weekofmonth=<custom:write property="weekofmonth"/>";
		strUrl=strUrl+"&<%= OvalTools.randomURL() %>";
		location.href=strUrl;
}
function page_save(num)
{
	var myform = eval("document.cform"+num);
	if(Number(myform.numrows.value)<1)
	 return;
	for(i=0;i<Number(myform.numrows.value);i++)
	{
		var sstart=eval("myform.splanstarttime"+i);
		var send=eval("myform.splanendtime"+i);
		var tsstart=eval("myform.tsplanstarttime"+i);
		var tsend=eval("myform.tsplanendtime"+i);
		
		var dvisit=eval("myform.planvisitdate"+i);
		var processid=eval("myform.processid"+i);
		var uprocessid=eval("myform.uprocessid"+i);
	    var activityType=eval("myform.activitytype"+i).value;
	  if(activityType == 1){
		if(isEmpty(processid.value) && isEmpty(uprocessid.value)){
  		   alert("<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_VisitProcess"))%>");
  		   processid.focus();
  		   return;
  		}
  	  }	
		
	}
		myform.actionname.value = "save";
 		myform.target="_self";
 		isRunning = true;
 		myform.submit();
}
function page_add(num)
{
	var myform = eval("document.cform"+num);
		
	var strUrl="VisitPlanAddPop.jsp?contactid=<custom:write property="contactid"/>&orgid=<custom:write property="orgid"/>";
		strUrl=strUrl+"&year=<custom:write property="year"/>&monthofyear=<custom:write property="monthofyear"/>&weekofmonth=<custom:write property="weekofmonth"/>&dayofweek="+num;
		strUrl=strUrl+"&visitplanid=<custom:write property="visitplanid" name="visitplaninfo"/>&weekstart=<custom:write property="weekstartdate"/>&weekend=<custom:write property="weekenddate" />";
		strUrl=strUrl+"&weekstartweekofmonth=<%=nStartDayWeekOfMonth%>&activitytype=1&<%= OvalTools.randomURL() %>";
    	
		 var status="height=500, width=800,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    if(popwindow!=null)
      popwindow.close();
   popwindow=window.open(strUrl, "addwindow", status);
}
function page_addother(num)
{
	var myform = eval("document.cform"+num);
		
	var strUrl="VisitPlanAddOtherPop.jsp?contactid=<custom:write property="contactid"/>&orgid=<custom:write property="orgid"/>";
		strUrl=strUrl+"&year=<custom:write property="year"/>&monthofyear=<custom:write property="monthofyear"/>&weekofmonth=<custom:write property="weekofmonth"/>&dayofweek="+num;
		strUrl=strUrl+"&visitplanid=<custom:write property="visitplanid" name="visitplaninfo"/>&weekstart=<custom:write property="weekstartdate"/>&weekend=<custom:write property="weekenddate" />";
		strUrl=strUrl+"&weekstartweekofmonth=<%=nStartDayWeekOfMonth%>&<%= OvalTools.randomURL() %>";
    	
		 var status="height=130, width=450,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
   if(popwindow!=null)
      popwindow.close();
   popwindow=window.open(strUrl, "addwindow", status);
}
function page_add2day(num)
{

	var strUrl="VisitPlanAdd2DayTemplet.jsp?contactid=<custom:write property="contactid"/>&orgid=<custom:write property="orgid"/>&dayofweek="+num;
	strUrl=strUrl+"&year=<custom:write property="year"/>&monthofyear=<custom:write property="monthofyear"/>&weekofmonth=<custom:write property="weekofmonth"/>";
	strUrl=strUrl+"&visitplanid=<custom:write property="visitplanid" name="visitplaninfo"/>&weekstart=<custom:write property="weekstartdate"/>&weekend=<custom:write property="weekenddate"/>";
	strUrl=strUrl+"&weekstartweekofmonth=<%=nStartDayWeekOfMonth%>&activitytype=1&<%= OvalTools.randomURL() %>";
	
	var status="height=500, width=800,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
	if(popwindow!=null)
  	popwindow.close();
	popwindow=window.open(strUrl, "addwindow", status);
	// return;
}
function page_delete(num)
{
	var myform = eval("document.cform"+num);
	var details=eval("document.cform"+num+".detailids");
	var dflag="";
    for (var i=0; i<Number(myform.numrows.value);  i++)
  	{
  		var checkboxs =document.getElementById("detailids_"+num+"_"+i);
  	     if(!checkboxs.disabled)
	  	   {
	  	     dflag=1;
	  	     break;
	  	   }
  	   
  	}
   if(dflag==1 || Number(myform.numrows.value)==0){
	if(isNullChecked(details))
    {
     alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
     return;
    }
   }else{
     alert("<%= message.getMessageDesc("INPUT_DEL_ONLY") %>");
     return;
   }
  <% if(nStatus==40){%>
  for(i=0;i<Number(myform.numrows.value);i++)
	{
	    var checkboxs = eval("myform.detailids_"+num+"_"+i);

	  	   if(checkboxs.checked)
	   {
		var plantype=eval("myform.plantype"+i);

	   if(plantype.value==1) {

	      alert("<%= message.getMessageDesc("CANNOT_DELETE_THIS_RECORD") %>");
          return;
	   }
	   
	   }
	
	}
	<%}%>
  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
  if(!flag)
    return;
		myform.actionname.value = "delete";
 		myform.target="_self";
 		isRunning = true;
 		myform.submit();
}
function page_move(num)
{
	var myform = eval("document.cform"+num);
	if(Number(myform.numrows.value)<1)
	 return;
	var details=eval("document.cform"+num+".detailids");
	
	if(isNullChecked(details))
	  {
	    alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_MOVE") %>");
	    return;
	  } 
	  
	var ids ="";
	
	  
	 // alert(checkboxs.length);
	  	for (var i=0; i<Number(myform.numrows.value); i++)
	  	{
	  		var checkboxs = eval("myform.detailids_"+num+"_"+i);
	  		
	  	   if(checkboxs.checked)
	  	   {
	  	   	if(ids=="")
	  	   	{
	  	   	ids=checkboxs.value;
	  	  
	  	   	}else{
	  	   	ids=ids+","+checkboxs.value;
	  	   
	  	   	}
	  	   }
	  	   
	  	}
	 

	
	

	var strUrl="VisitPlanMoveFrm.jsp?contactid=<custom:write property="contactid"/>&ids="+ids;
		strUrl=strUrl+"&year=<custom:write property="year"/>&monthofyear=<custom:write property="monthofyear"/>&weekofmonth=<custom:write property="weekofmonth"/>&dayofweek="+num;
		strUrl=strUrl+"&<%= OvalTools.randomURL() %>";
		 var status="height=500, width=800,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    if(popwindow!=null)
      popwindow.close();
   popwindow=window.open(strUrl, "movewindow", status);
}
function page_submitforapproval()
{
    if(Number(<%=JspHelper.filterNull( vDetails.size() )%>) <= 0)
    {
      alert("<%= message.getMessageDesc("NO_BODY_INFO",label.getLabelName("L_VisitActivity",false)) %>");
      return;
    }
    if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE_TO_SUBMIT_APPROVE") %>") )  return;
  	document.cformoptions.actionname.value = "submitforapproval";
  	document.cformoptions.target = "_self";
  	isRunning = true;
  	document.cformoptions.submit();
}

function page_action(action)
{
  if (action=="deny" || action == "agree")
  {
    if(Number(<%=JspHelper.filterNull( vDetails.size() )%>) <= 0)
    {
      alert("<%= message.getMessageDesc("NO_BODY_INFO",label.getLabelName("L_VisitActivity",false)) %>");
      return;
    }
    if(action=="agree"){
      if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE_TO_SUBMIT_APPROVE") %>") )  return;
  	  document.cformoptions.actionname.value = "submitweekplanapproval";
  	}else{
  	   document.cformoptions.actionname.value = "denysubmitweekplanapproval";
  	}
  	document.cformoptions.target = "_self";
  	isRunning = true;
  	document.cformoptions.submit();
  }
}
function page_submitplan()
{
	 if(Number(<%=JspHelper.filterNull( vDetails.size() )%>) <= 0)
    {
      alert("<%= message.getMessageDesc("NO_BODY_INFO",label.getLabelName("L_VisitActivity",false)) %>");
      return;
    }
    if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE_SUBMIT") %>") )  return;
  	document.cformoptions.actionname.value = "submitplan";
  	document.cformoptions.target = "_self";
  	isRunning = true;
  	document.cformoptions.submit();
}
function page_selectedday(nyear,nmonth,nweek,nday,ndate,ndetailid,processid,uprocessid,globalpccode,flag)
	{
		 var strUrl="";
		 if(flag=="disabled"){
		    flag="isview";
		 }
        strUrl="BeforeVisitPlanFrm.jsp?ishistory=<custom:write property="ishistory"/>&customerid="+ndetailid+"&processid="+processid+"&uprocessid="+uprocessid+"&contactid=<custom:write property="contactid"/>&globalpccode="+globalpccode;
		strUrl=strUrl+"&year="+nyear+"&monthofyear="+nmonth+"&weekofmonth="+nweek+"&dayofweek="+nday+"&dayofmonth="+ndate+"&vflag="+flag;
		strUrl=strUrl+"&<%= OvalTools.randomURL() %>";
	     if(document.all){
         var gotoLink = document.createElement('a');
         gotoLink .href = strUrl;
         document.body.appendChild(gotoLink);
         gotoLink .click();
         }
         else self.location.href = strUrl;
	}
function page_other(nyear,nmonth,nweek,nday,ndate,visitplandetailid,activitytype,processid)
	{
		if(processid==null || processid==""){
		 alert("<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_VisitProcess"))%>");
		 return;
		}
        strUrl="BeforeOtherVisitPlanMain.jsp?ishistory=<custom:write property="ishistory"/>&visitplandetailid="+visitplandetailid+"&contactid=<custom:write property="contactid"/>";
		strUrl=strUrl+"&year="+nyear+"&monthofyear="+nmonth+"&weekofmonth="+nweek+"&dayofweek="+nday+"&dayofmonth="+ndate;
		strUrl=strUrl+"&<%= OvalTools.randomURL() %>";
	     if(document.all){
         var gotoLink = document.createElement('a');
         gotoLink .href = strUrl;
         document.body.appendChild(gotoLink);
         gotoLink .click();
         }
         else self.location.href = strUrl;
	}
function page_processview(v)
{
	//var seq =v.name.substr(v.name.length-1, v.name.length);
	var re = /[^0-9]/g;
	var seq = v.name.replace(re, '');
	//var formname=v.form.name;
	var activitytype=eval("document."+v.form.name+".activitytype"+seq).value;
	var contactid=eval("document."+v.form.name+".contactid").value;
	var  datahandler = new  DataHandler() ;
	datahandler.add_params("activitytype" , activitytype,"integer") ;
	datahandler.add_params("contactid" , contactid,"integer") ;
	datahandler.getResultFromVector("allprocesses","processname" ,"visitprocessid" ,"document."+v.form.name+"."+v.name) ;
	datahandler.add_job("j_zylvisitprocess") ;
	datahandler.runDataHandler ();
}
</script>	
</head>

<body style="overflow: auto;">
  <input type="hidden" name="crownum" id="selectcrownum">	
  <input type="hidden" name="cseq" id="selectcseq">	
   <%
   java.util.HashMap parentuserinfo = (java.util.HashMap)pageContext.getAttribute("parentuserinfo"); 
   %>
  <TABLE cellSpacing=0 width="100%">
	  <TR>
	  	
	    <TD class=td-blue width="84%"><%=label.getLabelName("L_VisitPlanDate")%><%=label.getLabelName("L_Colon")%> <%=strWeekStart%>-<%=strWeekEnd%> </TD>
	    <TD class=td-blue width="16%" align="right"><%=label.getLabelName("L_Status")%><%=label.getLabelName("L_Colon")%> <%=strStatus%></TD>
	    
	  </tr>
  </table>
  <table width="100%" cellspacing="0" cellpadding="0">
		<form name="cformoptions" method="post" action="<%=contextPath%>/Dispatcher">
   <tr><td class="summary_top">
   	 <input type="hidden" name="pagename" value="p_visitplaneditdetail">
    <input type="hidden" name="actionname">
            
            	<%
  String strLanguageCode0;
  String strLanguageCode1;
  if(strLanguageCode.equalsIgnoreCase("cn"))
  {
	strLanguageCode0 = "cn";
	strLanguageCode1 = "en";
  }else{
	strLanguageCode0 = "en";
	strLanguageCode1 = "cn";
  }
%>
    <input type="hidden" name="languagecode0" value="<%= strLanguageCode0 %>">
    <input type="hidden" name="languagecode1" value="<%= strLanguageCode1 %>">
    <input type="hidden" name="languagecode2" value="<%= strLanguageCode0 %>">
    <input type="hidden" name="languagecode3" value="<%= strLanguageCode1 %>">
    <input type="hidden" name="entitytype0" value="NT">
    <input type="hidden" name="entitytype1" value="NT">
    <input type="hidden" name="entitytype2" value="NC">
    <input type="hidden" name="entitytype3" value="NC">
    <input type="hidden" name="numrows" value="4">
    <input type="hidden" name="content0">
    <input type="hidden" name="content1">
    <input type="hidden" name="content2">
    <input type="hidden" name="content3">
    <custom:hidden property="visitplanid" name="visitplaninfo" changedName="transactionid"/>
    <input type="hidden" name="subjectcode" value="2VPW">
    <custom:hidden property="orgid"/>
    <custom:hidden property="weekplancode" name="visitplaninfo" changedName="transactioncode"/>
    <custom:hidden property="visitplanid" name="visitplaninfo" changedName="slipid"/>

    <custom:hidden name ="userinfo" property ="userid" scope="session" changedName="fromuserid"/>
   	<input type="hidden" name="begindate" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">
    <custom:hidden property="contactid"/>
    
    <custom:hidden property="year"/>
    <custom:hidden property="monthofyear"/>
    <custom:hidden property="ishistory"/>
    <custom:hidden property="weekofmonth"/> 		
    <custom:hidden property="visitplanid" name="visitplaninfo"/> 
    	
    <custom:hidden property="weekstartdate" changedName="weekstart"/>
    <custom:hidden property="weekenddate" changedName="weekend"/>
    <input type="hidden" name="weekstartweekofmonth" value="<%=nStartDayWeekOfMonth%>"/>

            	</td></tr>
            <tr>
              <td class="td_center">
		<!-- <a onClick="javascript:page_finish()"><custom:button type="1" label="L_Finish" imgsrc="back.gif" border="0" style="width:60"/></a> -->
	<%if(visitplaninfo!=null ){
	if(nStatus==10){
	   if (nCurUserId.equals(contactid)) {
		   Calendar calendar = new GregorianCalendar();
	        // 取得本周一
	        calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
	                calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
	        calendar.setFirstDayOfWeek(Calendar.MONDAY);
	        calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
	        //out.println(new java.sql.Date(calendar.getTime().getTime()));
	        // 取得本周日
	        //out.println(new java.sql.Date(calendar.getTime().getTime()+ (6 * 24 * 60 * 60 * 1000)));
	        int optionvalue=0;
	        optionvalue= Integer.valueOf((String)pageContext.getAttribute("optionvalue")).intValue();
	        Date dateTime1 = new java.util.Date(calendar.getTime().getTime()+ (7 * 24 * 60 * 60 * 1000));
	        //out.println(new java.sql.Date(calendar.getTime().getTime()+ (7 * 24 * 60 * 60 * 1000)));//取得本周日
	        
	        //out.print(calendar.get(Calendar.WEEK_OF_YEAR));
	        calendar.add(Calendar.DATE, 7*optionvalue+6);
	        //out.print(calendar.get(Calendar.WEEK_OF_YEAR));
	        //out.println(new java.sql.Date(calendar.getTime().getTime()));
	        Date dateTime2 =new java.util.Date(calendar.getTime().getTime());
	        java.text.SimpleDateFormat sdf2Str1=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	        String dateFormat2=sdf2Str1.format(dateTime2);
	        //out.print(dateTime2);
	        //out.print(dWeekEnd);
	        //out.println(dateTime1.before(dWeekEnd)); 
	        //out.println(dWeekEnd.before(dateTime2)); 
	        //out.println(dWeekEnd.getTime()); 
	        //out.print(dateTime2.getTime());
	        if(dateTime1.before(dWeekEnd) && dWeekEnd.before(dateTime2)){
	   %>
			<!--a onclick="page_submitforapproval()"><custom:button type="1" label="L_Submit_batch" imgsrc="submit_batch.gif" border="0" style="width:60"/></a-->
    	<a onclick="page_submitplan()"><custom:button type="1" label="L_SubmitWeekPlan" imgsrc="submit_batch.gif" border="0" style="width:80"/></a>
    		
		
	 <%}}
	 }else if(nStatus==20){
		 //out.println(nParentUserId);out.println(nCurUserId);
	if (nCurUserId.equals(nParentUserId)) {
	  %>
    <a onclick="page_action('agree')"><custom:button type="1" label="L_Agree" imgsrc="Agree.gif" border="0" style="width:60"/></a>
    <a onclick="page_action('deny')"><custom:button type="1" label="L_Deny" imgsrc="no_agree.gif" border="0" style="width:60"/></a>
    <%}
    }else if(nStatus==29){%>
    <a onclick="page_remodify()"><custom:button type="1" label="L_ReModify" imgsrc="no_agree.gif" border="0" style="width:60"/></a>
	  		
    <%}else if(nStatus==40){%>
    <!--a onclick="page_closeplan()"><custom:button type="1" label="L_CloseVistPlan" imgsrc="no_agree.gif" border="0" style="width:60"/></a-->
	<%}%>		
			<%}%>
			<a onclick="window.opener.location.reload(); "><custom:button type="1" label="L_Back" imgsrc="no_agree.gif" border="0" style="width:60"/></a>   
		</td>
		
	</tr>
</form>
</table>
  <table width="100%" cellspacing="0" cellpadding="0" border="1">
  	<%
  	String[] weekLabelArrs=new String[]{"L_Monday","L_Tuesday","L_Wednesday","L_Thursday","L_Friday","L_Saturday","L_Sunday"};
		
  	 int numCurr = 0;
     HashMap oneDetail = null;
     
 	Calendar nowcal = Calendar.getInstance();
 	Calendar numcal = Calendar.getInstance();
 	nowcal.setFirstDayOfWeek(Calendar.MONDAY);
 	numcal.setFirstDayOfWeek(Calendar.MONDAY);
 	nowcal.add(Calendar.DAY_OF_MONTH, 1);
 	numcal.clear();
 	numcal.set(Calendar.YEAR, nYear);
 	numcal.set(Calendar.MONTH, nMonth - 1);
 	numcal.set(Calendar.WEEK_OF_MONTH, nWeek);
 	//numcal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    //out.print(new java.sql.Date(((Date)numcal.getTime()).getTime()) );
	
		
  	for(int i=1;i<=8;i++){
  	java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat(strFullDateFormat);
  	if(i%1==1){
  	%>
	<tr valign="top">
	<%}%>
	<td width="50%">
	<%if(i==8){%>&nbsp;
	<%}else{%>
	<form name="cform<%=i%>" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_visitplaneditdetail">
    <input type="hidden" name="actionname">
    <custom:hidden property="contactid"/>
    <custom:hidden property="orgid"/>
    <custom:hidden property="year"/>
    <custom:hidden property="monthofyear"/>
    <custom:hidden property="ishistory"/>
    <custom:hidden property="weekofmonth"/> 		
    <custom:hidden property="visitplanid" name="visitplaninfo"/> 
    <custom:hidden property="leaderchange"/> 
    
    <custom:hidden property="weekstartdate" changedName="weekstart"/>
    <custom:hidden property="weekenddate" changedName="weekend"/>
    <input type="hidden" name="weekstartweekofmonth" value="<%=nStartDayWeekOfMonth%>"/>			
			<table width="100%" cellspacing="0" cellpadding="0">
				<tr>
					<td>
					<table width="100%" cellspacing="0" cellpadding="0">
						<tr class="deepblue-left">
							<td><%=label.getLabelName(weekLabelArrs[i-1])%>(<%=sdf.format(cal.getTime())%>)</td>
							<td class="td_right">
										 <%--	<%
						    	
								
							if( visitplaninfo==null || visitplaninfo.isEmpty() ||  ((Integer)visitplaninfo.get("status")).intValue()==10) {
								%>
							 <a onClick="page_add('<%=i%>')"><custom:button type="2" label="L_Add" imgsrc="back.gif" border="0" style="width:60"/></a>
							 <a onClick="page_addother('<%=i%>')"><custom:button type="2" label="L_AddOther" imgsrc="back.gif" border="0" style="width:60"/></a>
							 	
							 <a onClick="page_delete('<%=i%>')"><custom:button type="2" label="L_Delete" imgsrc="back.gif" border="0" style="width:60"/></a>
        			 		<a onClick="page_save('<%=i%>')"><custom:button type="2" label="L_Save" imgsrc="back.gif" border="0" style="width:60"/></a>
							<!--<a onClick="page_move('<%=i%>')"><custom:button type="2" label="L_Move" imgsrc="back.gif" border="0" style="width:60"/></a>--> 
							 	<%}%>
							 	--%>
							 	
							 	
					<% 
						numcal.add(Calendar.DATE, 1);
					System.out.print("nStatus="+nStatus);
					if(nStatus==10 || nStatus==-1){
						if(numcal.compareTo(nowcal)>0){
							%>
					        <% if (nCurUserId.equals(contactid)) {%>
						     <a onClick="page_add('<%=i%>')"><custom:button type="2" label="L_Add" imgsrc="back.gif" border="0" style="width:60"/></a>
						     <a onClick="page_add2day(<%=i %>)"><custom:button type="2" label="L_AddByDay" imgsrc="back.gif" border="0" style="width:80" /></a>	
							 <a onClick="page_addother('<%=i%>')"><custom:button type="2" label="L_AddOther" imgsrc="back.gif" border="0" style="width:60"/></a>
							 <a onClick="page_delete('<%=i%>')"><custom:button type="2" label="L_Delete" imgsrc="back.gif" border="0" style="width:60"/></a>
        			 		  <%} %>
        			 		<a onClick="page_save('<%=i%>')"><custom:button type="2" label="L_Save" imgsrc="back.gif" border="0" style="width:60"/></a>
					             
					  <% }
					 }else{
					   if(numcal.compareTo(nowcal)>0){
					     if (!nCurUserId.equals(contactid)) {%>
						<a onClick="page_save('<%=i%>')"><custom:button type="2" label="L_Save" imgsrc="back.gif" border="0" style="width:60"/></a>	 	
				      <% }
					    }
					  }%>	 	
							 	
   					  </td>
						</tr>
					</table>
					</td>
				</tr>
				<tr>
				<td>
					<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
				<tr class="deepblue-left">
				<td class="title_center" width="1%">&nbsp;</td>
				<td class="title_center"  width="10%" ><%=label.getLabelName("L_PlanActivityTypeInfo")%></td>
          		<!--td class="title_center"   ><%=label.getLabelName("L_CustomerName")%></td>
          		<td class="title_center"  width="50" ><%=label.getLabelName("L_OrgPCName")%></td-->
          		<td class="title_center" width="10%"><%=label.getLabelName("L_CustomervisitProgram")%></td>
          		<td class="title_center" width="10%"><%=label.getLabelName("L_PeoplevisitProgram")%></td>
          		<td class="title_center"  width="5%" ><%=label.getLabelName("L_LastVisitDate")%></td>
          		<td class="title_center"  width="5%" ><%=label.getLabelName("L_CountVisitOfMonth")%></td>
          		<td class="title_center"  width="5%" ><%=label.getLabelName("L_NeedAssist")%></td>
          		<td class="title_center"  width="6%" ><%=label.getLabelName("L_Status")%></td>
          		<%if( visitplaninfo!=null && (!visitplaninfo.isEmpty())&&((Integer)visitplaninfo.get("status")).intValue()==10) {
								%>
          		
          		<%} else{%>
          		<td class="title_center"  width="6%" ><%=label.getLabelName("L_assistsatus")%></td>
          		<td class="title_center"  width="6%" ><%=label.getLabelName("L_visitstatus")%></td>
          		<td class="title_center"  width="6%" ><%=label.getLabelName("L_PlanType")%></td>
          		<%} %>
          		<td class="title_center" width="10%"><%=label.getLabelName("L_AssistUser")%></td>
          		<td class="title_center" width="10%"><%=label.getLabelName("L_ByAssistUser")%></td>
          	</tr>	 
          	<%
          	int seq=0;
          	if(numCurr<vDetails.size())
          	{
	          	if(oneDetail==null)
	          	{
	          		oneDetail=(HashMap)vDetails.get(numCurr);
	          		
	          	}
	          	seq=0;
	          	while(true){
	          	
          		Date dPlanVisitDate=(Date)oneDetail.get("planvisitdate");
          		
          		Calendar calPlanVisitDate=Calendar.getInstance();
          		java.text.SimpleDateFormat sdf2Str=new java.text.SimpleDateFormat("yyyy-MM-dd");
          		String sPlanVisitDate= sdf2Str.format(dPlanVisitDate);
          		dPlanVisitDate=sdf2Str.parse(sPlanVisitDate);
          		calPlanVisitDate.clear();
          		calPlanVisitDate.setTime(dPlanVisitDate);
          		
          		if(calPlanVisitDate.compareTo(cal)==0)
          		{
          			pageContext.setAttribute("onevisitdetail",oneDetail);
          			java.text.SimpleDateFormat sdf2Time=new java.text.SimpleDateFormat("HH:mm");
          			Date dStart=(Date)oneDetail.get("planstarttime");
          			Date dEnd=(Date)oneDetail.get("planendtime");
          			String sStart="";
          			String sEdit="";
          			if(dStart!=null)
          				sStart=sdf2Time.format(dStart);
          			if(dEnd!=null)
          				sEdit=sdf2Time.format(dEnd);
          			String sAssistChecked	="";
          			if("Y".equals(oneDetail.get("needassist")))
          				sAssistChecked="checked";
          			String strStyleClass="none";
          			if(seq%2==1)
          				strStyleClass="td-listrom";
          				String checkDisabled="";
          				String selectCheck="";
          				boolean selectDisabled=false;
          				String leaderchange=null;
          		 		if(request.getParameter("leaderchange")!=null)
                  		{
                  			leaderchange=(String)request.getParameter("leaderchange");
                  		}else if(session.getAttribute("leaderchange")!=null)
                  		{
                  			leaderchange=(String)session.getAttribute("leaderchange");
                  		}else if(pageContext.getAttribute("leaderchange")!=null)
                  		{
                  			leaderchange=(String)pageContext.getAttribute("leaderchange");
                  		}
          			if(oneDetail.get("changedid")!=null){
          				if(!nCurUserId.equals(oneDetail.get("changedid"))) {
          					checkDisabled="disabled";
              				selectDisabled=true;
              				selectCheck="disabled";
          				}
					}
          			if(!nCurUserId.equals((Integer)oneDetail.get("contactid"))){
          				selectDisabled=true;
          				selectCheck="disabled";
          			}
         			if(oneDetail.get("visitstatus")!=null)
          			{
          			if(((Integer)oneDetail.get("visitstatus")).intValue()==2)
          			{
          				checkDisabled="disabled";
          				selectDisabled=true;
          				selectCheck="disabled";
          			}
          			}

					if(oneDetail.get("assistisaccept")!=null){
						if(((Integer)oneDetail.get("assistisaccept")).intValue()==1){
							checkDisabled="disabled";
							selectDisabled=true;
							selectCheck="disabled";
						}
					}
					if(nCurUserId.equals((Integer)oneDetail.get("contactid"))){ 
					 if(oneDetail.get("status")!=null){
						if(((Integer)oneDetail.get("status")).intValue()!= 10){
							checkDisabled="disabled";
							selectDisabled=true;
							selectCheck="disabled";
						}
					 }
					}
					if(oneDetail.get("plandetailstatus")!=null)
          			{
          		    if(nCurUserId.equals((Integer)oneDetail.get("contactid"))){ 
          			 if(((Integer)oneDetail.get("plandetailstatus")).intValue()==20 || ((Integer)oneDetail.get("plandetailstatus")).intValue()==40)
          			   {
          				checkDisabled="disabled";
          				selectDisabled=true;
          				selectCheck="disabled";
          			   }
          		     }else{
          		      if(((Integer)oneDetail.get("plandetailstatus")).intValue()==40)
           			   {
           				//checkDisabled="disabled";
           				selectDisabled=true;
           				selectCheck="disabled";
           			   } 
          		     }
          			}
          		Integer oSeq=new Integer(seq);			
          	%> 
						<tr  onClick="" class="<%=strStyleClass%>"> 
							<td height="22">
								<input type="checkbox" id="detailids_<%=i%>_<%=seq%>" <%=selectCheck%> name="detailids" value="<custom:write name="onevisitdetail" property="visitplandetailid" />" class="normalradio">
								<custom:hidden name="onevisitdetail" property="visitplandetailid" colIndex="<%=oSeq%>" />
								<custom:hidden name="onevisitdetail" property="planvisitdate" colIndex="<%=oSeq%>" />
									
								<input type="hidden" name="splanstarttime<%=seq%>" />		
								<input type="hidden" name="splanendtime<%=seq%>" />	
								<custom:hidden name="onevisitdetail" property="needassist" colIndex="<%=oSeq%>" />	
								<custom:hidden name="onevisitdetail" property="changedid" colIndex="<%=oSeq%>"  />	
							</td>
							<td>
								<%pageContext.setAttribute("displayflag","view");%>
								<% 
							    Integer activityType=(Integer)oneDetail.get("activitytype");
							    if(activityType.intValue()==1 || activityType.intValue()==2){%>
								<custom:selectdic name="onevisitdetail" property="activitytype" dictType="ZVisitProcessType"  />
           		                <%}%>
           		                <custom:hidden name="onevisitdetail" property="activitytype" colIndex="<%=oSeq%>"></custom:hidden>
							<%
							//Integer activityType=(Integer)oneDetail.get("activitytype");
							String disabledByActivityType="";
							boolean isDisabledByActivityType=false;
							if(activityType.intValue()==1){
							%>
							<a onClick="javascript:page_selectedday('<custom:write name="onevisitdetail" property="year"/>','<custom:write name="onevisitdetail" property="monthofyear"/>','<custom:write name="onevisitdetail" property="weekofmonth" />','<custom:write name="onevisitdetail" property="dayofweek" />','<custom:write name="onevisitdetail" property="planvisitdate" />','<custom:write name="onevisitdetail" property="customerid" />','<custom:write name="onevisitdetail" property="processid" />','<custom:write name="onevisitdetail" property="uprocessid" />','<custom:write name="onevisitdetail" property="globalpccode" />','<%=selectCheck%>');">
								(
								<custom:write name="onevisitdetail" property="customercode" nbsp="true"/>
									&nbsp;
								<custom:write name="onevisitdetail" property="customername" nbsp="true" />
									&nbsp;
									<custom:selectdic name="onevisitdetail" property="globalpccode" dictType="GlobalPCCode"  />
           		
								
									)
							</a> 		
						
							<%}else{
						      if(activityType.intValue()==2){
								disabledByActivityType="disabled";
								isDisabledByActivityType=true;
								selectDisabled=true;
						      }else{
						    %>
							  <a onclick="javascript:page_other('<custom:write name="onevisitdetail" property="year"/>','<custom:write name="onevisitdetail" property="monthofyear"/>','<custom:write name="onevisitdetail" property="weekofmonth" />','<custom:write name="onevisitdetail" property="dayofweek" />','<custom:write name="onevisitdetail" property="planvisitdate" />','<custom:write name="onevisitdetail" property="visitplandetailid" />','<custom:write name="onevisitdetail" property="activitytype" />','<custom:write name="onevisitdetail" property="processid" />');" >
							   <custom:selectdic name="onevisitdetail" property="activitytype" dictType="ZVisitProcessType"  />
							  </a>
							 <% 
							  }
							%> 
							<%}
							pageContext.setAttribute("displayflag","");
							%>
								</td>
							<!--td><a onclick=""><custom:write name="onevisitdetail" property="customercode" nbsp="true"/></a></td>
							<td><custom:write name="onevisitdetail" property="customershortname" nbsp="true" /></td>
							<td><custom:write name="onevisitdetail" property="globalpcname" nbsp="true"/></td-->
							<%if(activityType.intValue()==1){ %>
							<td><custom:select name="onevisitdetail"  property="processid" disabled="<%=selectDisabled%>" optionsName="customprocesses" optionValueKey="visitprocessid" optionInnerTextKey="processname"  colIndex="<%=oSeq%>" defaultValue="---" defaultValueCost=" "/></td>
							<td><custom:select name="onevisitdetail"  property="uprocessid" disabled="<%=selectDisabled%>" optionsName="doctorprocesses" optionValueKey="visitprocessid" optionInnerTextKey="processname"  colIndex="<%=oSeq%>" defaultValue="---" defaultValueCost=" "/></td>
						    <%}else {
						    	if(activityType.intValue()!=2){ %>
						    <%
							 Vector  activityprocesses = (Vector) pageContext.getAttribute("activityprocesses");
							 Vector otherprocesses=new Vector();
							 if(activityprocesses == null)  activityprocesses = new Vector();
							 for(int e=0;e<activityprocesses.size();e++){
								 if(((Integer)((HashMap)activityprocesses.get(e)).get("visitprotype")).equals(activityType) || ((Integer)((HashMap)activityprocesses.get(e)).get("visitprotype")).intValue()==0){
									 otherprocesses.add(((HashMap)activityprocesses.get(e)));
								 }
							 }	 
							 pageContext.setAttribute("otherprocesses",otherprocesses);
							%>
						    <td><custom:select name="onevisitdetail"  property="processid" disabled="<%=selectDisabled%>" optionsName="otherprocesses" optionValueKey="visitprocessid" optionInnerTextKey="processname"  colIndex="<%=oSeq%>" defaultValue="---" defaultValueCost=" "  /></td>
						    <td>&nbsp;</td>
						       <%} else{
						    	%>
						    	<td>&nbsp;</td>
						    	<td>&nbsp;</td>
						       <% 
						       }
						      }
						    %>
						<!--<td><input type="text" size="6"  name="tsplanstarttime<%=seq%>"  <%=checkDisabled%>  value="<%=sStart%>" /></td>
							<td><input type="text" size="6"   name="tsplanendtime<%=seq%>"  <%=checkDisabled%>  value="<%=sEdit%>"  /></td>-->
							<td><custom:write name="onevisitdetail" property="lastvisitdate" nbsp="true" /></td>
							<td><custom:write name="onevisitdetail" property="count_org" nbsp="true" /></td>
							<custom:hidden   name="onevisitdetail" property="customerid"  colIndex="<%=oSeq%>"/>
							<td><input type="checkbox" <%=disabledByActivityType%>  name="showneedassist<%=seq%>"  <%=checkDisabled%> value="Y" <%=sAssistChecked%> class="normalradio" onclick="javascript:page_needassist('<%=i%>','<%=seq%>','<%=parentuserinfo.get("assistuserid")%>','<%=parentuserinfo.get("assistusername")%>','<%=parentuserinfo.get("assistemployeename")%>')"></td>
							<td><custom:write property="plandetailstatus" name="onevisitdetail" dictType="Status" nbsp="true"/>
								<%
							if( visitplaninfo!=null && (!visitplaninfo.isEmpty())&&((Integer)visitplaninfo.get("status")).intValue()==10) {
								%>
						
							<%} else{%>
	                        <td><custom:write property="assistisaccept" name="onevisitdetail" dictType="AssistAcceptStatus" nbsp="true"/></td>
	                        <td><custom:write property="visitstatus" name="onevisitdetail" dictType="VisitStatus" nbsp="true"/>
	                        <custom:hidden   name="onevisitdetail" property="plantype"  colIndex="<%=oSeq%>"/></td>
	                        <td><custom:write property="plantype" name="onevisitdetail" dictType="PlanType" nbsp="true"/>
          	               	<%} %>
          	               	<td>&nbsp;
							 <div id="assistdiv_<%=i%>_<%=oSeq%>" name="assistdiv<%=oSeq%>">
							 <% if(("checked").equals(sAssistChecked)){
							     if(("disabled").equals(checkDisabled)){%>
							      <custom:write name="onevisitdetail" property="assistusername"  /><custom:write name="onevisitdetail" property="assistemployeename"  />
							      <%}else{ %>
							 <custom:text name="onevisitdetail" property="assistusername" size="6" colIndex="<%=oSeq%>" />
							 <a onclick="javascript:page_selectUser('<%=i%>','<%=seq%>');">
							 <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" />
							 </a>
							 <custom:text name="onevisitdetail" property="assistemployeename" size="6" colIndex="<%=oSeq%>" />
							      <%} %>
							 <%}else{ 
							   if(("disabled").equals(checkDisabled)){%>
							   <custom:write name="onevisitdetail" property="assistusername"  /><custom:write name="onevisitdetail" property="assistemployeename"  />
							   <%}else{ %>
							  <custom:text name="onevisitdetail" property="assistusername" size="6" colIndex="<%=oSeq%>" />
							 <a onclick="javascript:page_selectUser('<%=i%>','<%=seq%>');">
							 <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" />
							 </a>
							  <custom:text name="onevisitdetail" property="assistemployeename" size="6" colIndex="<%=oSeq%>" />
							 </div>
							 <%}} %>
							  <custom:hidden name="onevisitdetail" property="assistuserid" colIndex="<%=oSeq%>"/>
							</td>
							<td>&nbsp; <custom:write name="onevisitdetail" property="byassistusername"  /> <custom:write name="onevisitdetail" property="byassistemployeename"  /></td>
						</tr>
					  
			<%
			seq++;
					numCurr++;
          if(numCurr<vDetails.size())
          {
          	oneDetail=(HashMap)vDetails.get(numCurr);
          }
        else
        	break;
			}
		else{
			break;
			}
			}
			}%>
					</table>
					<input type="hidden" name="numrows" value="<%=seq%>"/>
								
				</td>
				</tr>
			</table>	
 <script>
  var cnum=eval("document.cform"+<%=i%>+".numrows").value;
  for(var i=0;i<cnum;i++){
    if(eval("document.cform"+<%=i%>+".needassist"+i).value=="Y"){
        var div =document.getElementById("assistdiv_"+<%=i%>+"_"+i);
		div.style.display = 'block';
		<%
		if (parentuserinfo!=null) {
		%>
		 if(isEmpty(eval("document.cform"+<%=i%>+".assistuserid"+i).value)){
		  eval("document.cform"+<%=i%>+".assistuserid"+i).value="<%=parentuserinfo.get("assistuserid")%>";
		  eval("document.cform"+<%=i%>+".assistusername"+i).value="<%=parentuserinfo.get("assistusername")%>";
		  eval("document.cform"+<%=i%>+".assistemployeename"+i).value="<%=parentuserinfo.get("assistemployeename")%>";
		 }
		<%
		}
	    %>
    }else{
        var ndiv =document.getElementById("assistdiv_"+<%=i%>+"_"+i);
		ndiv.style.display = 'none';
    }
  }
</script> 
			</form>  	
			<%
			cal.add(Calendar.DATE,1);
			}%>
		</td>
		<%if(i%1==0){%>
	 </tr>
	 <%}
	 }%>
	</table>	
</body>

</html>
	
